package com.wdc.hashtable;

import java.util.HashMap;

@SuppressWarnings("all")
public class E02Leetcode217 {
    public  static boolean containsDuplicate(int[] nums) {
        HashMap<Integer, Integer> map = new HashMap<>();
        int number = 0;
        for (int num : nums) {
                map.put(num,number);
                number = map.get(num);
            if (map.get(num) != null ){
                map.put(num,map.get(num)+1);
            }
            if (map.get(num) > 1){
                return true;
            }
            number = 0;
        }

        return false;

    }

    public static void main(String[] args) {
        int[] nums = {1,2,3,1};
        System.out.println(containsDuplicate(nums));

    }
}
